//1. 引入路由和Vue
import Vue from "vue";
import VueRouter from "vue-router";

//2. 引入路由组件
import Home from "../pages/Home";
import Login from "../pages/Login";
import News from "../pages/Home/News";
import Pay from "../pages/Home/Pay";
import Music from "../pages/Home/Music";

//2. 使用VueRouter这个插件
Vue.use(VueRouter);

//3. 创建路由对象
const router = new VueRouter({
  //路由表配置
  routes: [
    {
      path: "/home",
      component: Home,
      name: "home",
      children: [
        {
          path: "news",
          component: News,
          name: "news",
        },
        {
          path: "pay",
          component: Pay,
          name: "pay",
        },
        {
          path: "Music",
          component: Music,
          name: "music",
        },
      ],
    },
    {
      path: "/Login",
      component: Login,
      name: "login",
    },
  ],
});

//4. 把创建好的路由对象暴露出去
export default router;
